# coding=utf-8
import requests

robot_url = "https://oapi.dingtalk.com/robot/send?access_token=d0cf43da2819d91c5c18b9a395e4778c474a7aa38ffecd8cd4d844703ffae8b9" # 自己调试群
# robot_url = "https://oapi.dingtalk.com/robot/send?access_token=c1dad9d4693bf3f409f6f98260868194eaf05332109d5abda0cecc87a7f739bb"  # 正式发送群

# 推送钉钉消息调用方法（消息内容@手机号，手机号）
def send_ding(content, mobile):

    robot_body = {
        "msgtype": "text",
        "text": {
            "content": content
        },
        "at": {
            "atMobiles": [
                mobile,

            ],
            "isAtAll": False
        }
    }
    r = requests.post(robot_url, json=robot_body)
    if r.status_code == 200:
        return True
    else:
        return False


# 钉钉推送测试报告调用方法（标题，内容，文件链接）
def send_link(tittle, text, url):

    robot_body = {
        "msgtype": "link",
        "link": {
            "text": text,
            "title": tittle,
            "picUrl": "https://oss-public.fangdd.com/test/jinyiyun/supplychain/FtkV_U3Yi7KH3tHz4vQoHGcAY_J0.png",
            "messageUrl": url}
    }
    r = requests.post(robot_url, json=robot_body)
    if r.status_code == 200:
        return True
    else:
        return False




if __name__ == '__main__':
    a = ""
    send_ding(a, 13058019302)
